package msn;

import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.net.Socket;
import java.net.UnknownHostException;

import tools.Config;
import tools.Message;

public class Msn {
	private int TrID;
	private Socket NS;
	private Config config;
	private String CachedNS;
	public Msn()
	{
		TrID = 0;
		config = new Config();
		CachedNS = config.GetProperty("CachedNS");
	}
	public boolean Login(String passport, String password)
	{
		String NSaddress = ""; 
		if (CachedNS.length() == 0)
		{
			
		}
		else
		{
			NSaddress = CachedNS;
		}
		return true;
	}
	public String GetNewNS(String passport, String password)
	{
		try {
			Socket DS = new Socket("messenger.hotmail.com", 1863);
			OutputStream out = DS.getOutputStream();
			InputStream in = DS.getInputStream();
			String cmd = ">>> VER "+TrID+" MSNP8 CVR0\r\n";
			TrID++;
			Message.SendCommand(cmd,out);
			String message = Message.ReadCommand(in);
			if (Message.GetCommand(message) == Message.Command.VER)
			{
				
			}
		} catch (UnknownHostException e) {
			e.printStackTrace();
		} catch (IOException e) {
			e.printStackTrace();
		}
		return "";
	}
}
